/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cn.jhelper.unit06.demo;

import java.util.Stack;

/**
 *
 * @author Administrator
 */
public class StackDemo {
    public static void main(String[] args) {
        Stack s = new Stack();
        s.push("1");
        s.push("2");
        s.push("3");
        s.push("4");
        System.out.println("最先出来的元素是：");
        System.out.println(s.peek());
        System.out.println(s);
        System.out.println("存储在栈中的元素为：");
        while(!s.empty()){
            System.out.println(s.pop());
        }
 
    }
}
